package interfazUsuario.botones;

import interfazUsuario.Pintable;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

import cultivameCore.geometria.Punto;
import cultivameCore.motor.Accion;

public abstract class BotonAbstract implements Pintable {
	
	private boolean visible=true;
	private Punto p;
	private Image img;
	private int id;
	private Accion accion=null;
	
	public BotonAbstract(Punto p, Image img){
		this.setPunto(p);
		this.img=img;
	}

	public abstract void drawme(Graphics g);
	
	public Punto getPunto() {
		return p;
	}	

	public void setPunto(Punto p) {
		this.p=p;;
	}
	
	public Image getImg() {
		return img;
	}

	public void setImg(Image img) {
		this.img = img;
	}
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	
	public boolean isVisible() {
		return visible;
	}

	public void setVisible(boolean visible) {
		this.visible = visible;
	}
	
	public abstract BotonAbstract isSelected(Punto p);
	
	public boolean isSelected(int id){
		return id==this.id;
	}
	
	public void setAccion(Accion accion){
		this.accion=accion;
	}
	
	public void click(){
		if (accion!=null){
			accion.action();
		}
	}

	
}
